package com.example.myapplication;

import android.bluetooth.BluetoothAdapter;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    private static final int REQUEST_ENABLE_BT = 11;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Log.e("AAAAA","2222");



    }
    public void startClick(View view) {
        BluetoothAdapter mBluetoothAdatar=BluetoothAdapter.getDefaultAdapter();
        if(mBluetoothAdatar==null){
            Toast.makeText(this,"当前设备不支持蓝牙！",Toast.LENGTH_SHORT).show();
            return;
        }
        if (!mBluetoothAdatar.isEnabled()) {
            Intent enableBtIntent=new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
            startActivityForResult(enableBtIntent,REQUEST_ENABLE_BT);
        }

    }
    public void stopClick(View view) {

    }
}